package com.example.lenovo.demo.view.customview;

import android.os.CountDownTimer;
import android.widget.Button;

/**
 * Created by Administrator on 2017/1/10.
 */

public class TimerUtil extends CountDownTimer {
    private Button button;
    public TimerUtil(Button button,long millisInFuture, long countDownInterval) {
        super(millisInFuture, countDownInterval);
        this.button = button;
    }

    @Override
    public void onTick(long l) {

        button.setText(l/1000 + "秒后重新验证");
        button.setClickable(false);
    }

    @Override
    public void onFinish() {
        button.setText("重新验证");
        button.setClickable(true);
    }
}
